<?
	include '../model/database.php';
	include '../model/xl_dia_diem_yeu_thich.php';
	
	$xl_dia_diem = new xl_dia_diem_yeu_thich();
	
	$madiadiem = $_REQUEST['placeId'];
	$manguoidung = $_REQUEST['userid'];
	
	$tongyeuthich = $xl_dia_diem->tongYeuThich($madiadiem);
	$isDiaDiem = $xl_dia_diem->isDiaDiem($madiadiem,$manguoidung);
	$data = array("success"=>false);
	
	if($isDiaDiem)
		$data = array("success"=>true,"result"=>$tongyeuthich);
	else{
		if($xl_dia_diem->themDiaDiem($madiadiem,$manguoidung))
			$data = array("success"=>true,"result"=>$tongyeuthich);
	}
	echo json_encode($data);	
	
?>